#include <stdio.h>
#include <stdlib.h>

struct ListNode {
    int data;
    struct ListNode *next;
};

struct ListNode *createlist();
struct ListNode *deleteeven( struct ListNode *head );
void printlist( struct ListNode *head )
{
     struct ListNode *p = head;
     while (p) {
           printf("%d ", p->data);
           p = p->next;
     }
     printf("\n");
}

int main()
{
    struct ListNode *head;

    head = createlist();
    head = deleteeven(head);
    printlist(head);

    return 0;
}

struct ListNode *createlist(){
	struct ListNode * p ,*head=NULL,*tail;
	int size = sizeof (struct ListNode);
	int n,i;
	scanf("%d",&n);
	for (i=0;n!=-1;i++)
	{
		
		p=(struct ListNode *) malloc(size);
		p->data = n;
		
		if(head==NULL){
			head=p;
			tail=p;
		}
		else {
			tail->next = p;
		}
		tail = p;
		
		
		
		scanf("%d",&n);
	}
	p->next=NULL;
	
	return head;
} 
struct ListNode *deleteeven( struct ListNode *head )
{
	struct ListNode *p,*p1,*p2;
	
	while(head && head->data %2 ==0){ 
		p1=head;
		head = head->next;
		free(p1);
	}
	p1=head;
	while(p1 && p1 ->next !=NULL) 
	{
		while(p1->next && p1->next->data%2==0)
		{	
			p2=p1->next;
			p1->next=p2->next;	
		}
		p1=p1->next;
	}
	return head;
}
